function parsave(fname, Z, W, eta, invlambda, accu, etimes, fvals, postdim, macc, mfval, regvals, ell, alphav, invsigmaetasqr, invsigmawsqr, invsigmaxsqr, poisstrunc, algtype, maxiter, burnin, dobuffer)
varname = {'Z', 'W', 'eta', 'invlambda', ...
    'accu', 'etimes', 'fvals', 'postdim', 'macc', 'mfval', ...
    'regvals', 'ell', 'alphav', 'invsigmaetasqr', 'invsigmawsqr', 'invsigmaxsqr', ...
    'poisstrunc', 'algtype', 'maxiter', 'burnin' ...
};
if exist(fname, 'file')
    save(fname, varname{:}, '-append');
else
    save(fname, varname{:});
end

if dobuffer
    bfrd_vars_opt.Z = Z;
    bfrd_vars_opt.W = W;
    bfrd_vars_opt.eta = eta;
    bfrd_vars_opt.invlambda = invlambda;
    bfrd_iter = size(accu, 2);
    save(fname, 'bfrd_vars_opt', 'bfrd_iter', '-append');
end

end